import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:moose_app/ui/values/constants.dart';

class ATHOperatorView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        ATHOperatorItem(
          icon: "icon_share_r",
          text: "分享",
          left: 0,
        ),
        ATHOperatorItem(
          icon: "icon_comment_r",
          text: "评论",
        ),
        ATHOperatorItem(
          icon: "icon_collect_r",
          text: "收藏",
        ),
        ATHOperatorItem(
          icon: "icon_like_r",
          text: "点赞 8880",
        ),
      ],
    );
  }
}

class ATHOperatorItem extends StatelessWidget {
  final String icon;

  final String text;

  final double left;

  ATHOperatorItem({@required this.icon, @required this.text, this.left});

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(left: left == null ? kSize20 : 0),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          SvgPicture.asset('assets/icons/operation/$icon.svg', height: kSize38),
          Text(
            text,
            style: TextStyle(fontSize: kFontSize24),
            maxLines: 1,
            overflow: TextOverflow.ellipsis,
          )
        ],
      ),
    );
  }
}
